using Accona.Monitoring.Consumers;
using Accona.Monitoring.Exposure;
using Accona.Monitoring.Publishers;

namespace Accona.Monitoring
{
    public class MonitorConfigurationBase : IMonitorConfiguration
    {
        protected Monitor _monitor;

        public MonitorConfigurationBase()
        {
            
        }

        public MonitorConfigurationBase(Monitor monitor)
        {
            _monitor = monitor;
        }


        public IMonitorConfiguration WithConsumer<T>() where T : IConsumer, new()
        {
            _monitor._config.AddConsumer(new T());
            return this;
        }

        public IMonitorConfiguration WithPublisher<T>() where T : IPublisher, new()
        {
            _monitor._config.AddPublisher(new T());
            return this;
        }

        public IMonitorConfiguration WithExposure(IExposure exposure)
        {
            _monitor._config.AddExposure(exposure);
            return this;
        }

        public Scheduler Schedule(int milliseconds)
        {
            var schedule = new Schedule(milliseconds);
            var scheduler = new Scheduler(_monitor,schedule);
            return scheduler;
        }


    }
}